<template>
	<view class="poster">
		<view class="bg flex column aic jcc">
			<image class="qrcode" :src="qrcode" mode="widthFix"></image>
		</view>
	</view>
</template>

<script>
	import { mapState } from "vuex"
	export default {
		data() {
			return {
			}
		},
		computed: {
			...mapState(["qrcode","userInfo"])
		},
		onLoad() {
			if(!this.userInfo) {
				this.$store.dispatch("reLogin")
				return;
			}
			if(!this.qrcode) {
				this.getQrcode();
			}
		},
		methods: {
			getQrcode() {
				 uni.showLoading()
				 var param = {
					appid: this.$mConfig.appid,
					scene: "userId=" + this.userInfo.id,
					envVersion: "trial"
				 }
				this.$apis.getInviteQrcode(param).then(res=>{
					this.$store.dispatch("setPosterQrcode", res.data)
					uni.hideLoading()
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.poster {
		width: 100%;
		height: 100vh;
		overflow: hidden;
		.bg {
			position: relative;
			width: 100%;
			height: 100%;
			background-image: url('');
			background-size: 100% 100%;
			.qrcode  {
				position: absolute;
				width: 300upx;
				left: 50%;
				bottom: 40%;
				margin-left: -150upx;
				margin-bottom: -200upx;
			}
		}
	}
</style>